package com.anyisn.anyflickr.shell.controller
{
	import com.adobe.webapis.flickr.AuthResult;
	import com.anyisn.anyflickr.common.ApplicationConstants;
	import com.anyisn.anyflickr.shell.model.ListPhotosProxy;
	import com.anyisn.anyflickr.shell.model.PhotoProxy;
	import com.anyisn.anyflickr.shell.model.SlidePhotosProxy;
	
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.command.SimpleCommand;
	
	public class LoginSuccessCommand extends SimpleCommand
	{
		override public function execute(notification:INotification) : void {
			var data:AuthResult = notification.getBody() as AuthResult;
			var photoP:PhotoProxy = facade.retrieveProxy(PhotoProxy.NAME) as PhotoProxy;
			var photosP:ListPhotosProxy = facade.retrieveProxy(ListPhotosProxy.NAME) as ListPhotosProxy;
			var slideP:SlidePhotosProxy = facade.retrieveProxy(SlidePhotosProxy.NAME) as SlidePhotosProxy;
			
			photoP.login(data);
			photosP.login(data);
			slideP.login(data);
			
			var photoMenu:Array = ApplicationConstants.photoMenu;
			photoMenu[0].enabled = true;
		}
	}
}